-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
35 lines (28 loc) · 836 Bytes
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int t, pa, pb;
double g1, g2;
t = sc.nextInt();
for (int i = 1; i <= t; i++) {
int j = 0;
pa = sc.nextInt();
pb = sc.nextInt();
g1 = sc.nextDouble();
g2 = sc.nextDouble();
while (pa <= pb) {
pa *= (g1 / 100.0) + 1.0;
pb *= (g2 / 100.0) + 1.0;
j++;
if (j > 100) {
System.out.println("Mais de 1 seculo.");
break;
}
}
if (j <= 100)
System.out.println(j + " anos.");
}
sc.close();
}
}